package com.bby.screentool.bean;

import cn.hutool.core.util.ObjectUtil;

public class Action {
    public static final String ASK = "ASK";
    public static final String ANSWER = "ANSWER";
    public static final String OFFER = "OFFER";
    public static final String ICE = "ICE";
    public static final String RELEASE = "RELEASE";
    public static final String ERROR = "ERROR";
    public static final String RECORD_READY = "RECORD_READY";
    public static final String NOT_RECORD = "NOT_RECORD";
    public static final String SUCCESS = "SUCCESS";
    String action;
    String targetId;
    String from;

    String data;

    public Action() {
        from = "server";
    }

    public Action(String action) {
        super();
        this.action=action;
    }

    public Action(String action, String targetId) {
        this.action=action;
        this.targetId=targetId;
    }

    public Action(String action, String targetId, String data) {
        this(action,targetId);
        this.data = data;
    }

    public String getAction() {
        return action;
    }

    public String getData() {
        return data;
    }

    public void setFrom(String from) {
        this.from = from;
    }

    public void setData(String data) {
        this.data = data;
    }

    public String getFrom() {
        return from;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public String getTargetId() {
        return targetId;
    }

    public void setTargetId(String targetId) {
        this.targetId = targetId;
    }

    public boolean startSend() {
        return "start receive".equals(action);
    }

    public boolean empty() {
        return ObjectUtil.isEmpty(action)||ObjectUtil.isEmpty(targetId);
    }
}
